package com.thb.pay.mq.process;

import com.alibaba.fastjson.JSON;
import com.thb.pay.mq.utils.DetailRes;
import lombok.extern.slf4j.Slf4j;

/**
 * @Author: lucky
 * @Descrpiton:
 * @Date: 11:50 2018/9/3
 * @Modify by:
 */
@Slf4j
public abstract class AbsMessageProcess<T> implements MessageProcess<T> {

    public DetailRes process(T message) {
        try {
            processMessage(message);
            return new DetailRes(true, "");
        } catch (Exception e) {
            log.error("process message nothing error.\\{}", e);
            return new DetailRes(true, "process business message:{" + JSON.toJSONString(message) + "}");
        }
    }

    public abstract void processMessage(T message);


}
